home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000047_icon-group-sender _Mon Jun 1 13:51:26 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id NAA25760
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 1 Jun 1998 13:51:25 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA06925; Mon, 1 Jun 1998 13:51:19 -0700
  7. Date: Mon, 1 Jun 1998 12:47:16 -0500 (CDT)
  8. From: Chris Tenaglia <cdt@post.its.mcw.edu>
  9. To: icon-group@optima.CS.Arizona.EDU
  10. Subject: disp.icn
  11. Message-Id: <Pine.SOL.3.96.980601124103.8745A-100000@post.its.mcw.edu>
  12. Mime-Version: 1.0
  13. Content-Type: TEXT/PLAIN; charset=US-ASCII
  14. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  15. Status: RO
  16. Content-Length: 1993
  17.  
  18. >From cdt@post.its.mcw.edu Mon Jun  1 12:38:06 1998
  19. Status: O
  20. X-Status: 
  21. Newsgroups: 
  22. Date: Mon, 1 Jun 1998 12:38:06 -0500 (CDT)
  23. From: Chris Tenaglia <cdt@post.its.mcw.edu>
  24. To: icon-group@cs.arizona.edu
  25. Subject: disp.icn
  26. Fcc: sentmail
  27. Message-ID: <Pine.SOL.3.96.980601123411.6757A@post.its.mcw.edu>
  28. MIME-Version: 1.0
  29. Content-Type: TEXT/PLAIN; charset=US-ASCII
  30.  
  31. Here's a little snippet I found useful. We use mostly PCs
  32. but the unix servers still have apps in Xwindows. As we
  33. log in from various PCs, the DISPLAY variable in the unix
  34. shell needs to change. So here is disp.icn
  35. Environment solaris/unix. c-shell. telnet session.
  36. After I compile it onto the path I put this line in .cshrc
  37.  
  38. setenv DISPLAY `disp`
  39.  
  40. Note : If you have other telnet sessions from other computers
  41. simultaneously, you may get their display instead. You also
  42. must the X-server running on your PC/MAC/Xterm as appropriate.
  43. Tested on : SunOS xxx 5.5.1 Generic_103640-14 sun4m sparc
  44. SUNW,SPARCstation-5
  45. Enjoy.
  46.  
  47. ####################################################################
  48. #
  49. # file : disp.icn
  50. # desc : determine the "DISPLAY" variable for Xwindows in a solaris
  51. #        unix session
  52. # use  : disp (called by .login or .cshrc)
  53. #
  54. # update           by             what
  55. # 01-jun-1998      tenaglia       initial write
  56. #
  57. procedure main()
  58.   com1 := "env >disp.tmp"
  59.   system(com1)
  60.   in := open("disp.tmp")
  61.   every line := !in do if match("USER",line) then self := parse(line,'= ')[2]
  62.   close(in)
  63.  
  64.   com2 := "who >disp.tmp"
  65.   system(com2)
  66.   in := open("disp.tmp")
  67.   every line := !in do if match(self,line) then display := parse(line,' \t')[6]
  68.   close(in)
  69.  
  70.   remove("disp.tmp")
  71.   write(display[2:-1],":0.0")
  72.   end
  73.  
  74. #
  75. # parse a string into a list with respect to a delimiter
  76. #
  77. procedure parse(line,delims)
  78.   static chars
  79.   chars  := &cset -- delims
  80.   tokens := []
  81.   line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
  82.   return tokens
  83.   end
  84. #################################################################  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.